package com.study.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author xuhuai
 */
@RestController
@Api(tags = "演示接口")
public class TestController {
    @GetMapping("test1")
    @ApiOperation("测试简单请求")
    public Object test1() {
        return "test1 ok!";
    }

    @GetMapping("test2")
    @ApiOperation("测试token获取")
    public Object test2(HttpServletRequest httpServletRequest) {
        return "token值为：" + httpServletRequest.getHeader("x-token");
    }
}
